/*
 * UIConfiguraciones.java
 *
 * Created on 6 de marzo de 2008, 15:12
 */

package vista;

import controlador.CAlta;
import controlador.CListar;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JOptionPane;
import negocios.Configuracion;

/**
 *
 * @author  Administrador
 */
public class UIConfiguraciones extends javax.swing.JFrame 
{
    private Configuracion configuracion = new Configuracion();
    /** Creates new form UIConfiguraciones */
    public UIConfiguraciones() 
    {
        initComponents();
        Dimension pantalla, cuadro;
        pantalla = Toolkit.getDefaultToolkit().getScreenSize();
	cuadro = this.getSize();
	this.setLocation(((pantalla.width - cuadro.width)/2), (pantalla.height - cuadro.height)/2);
        this.inicio();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jLLocalidad2 = new javax.swing.JLabel();
        jLLocalidad3 = new javax.swing.JLabel();
        jTCarpeta = new javax.swing.JTextField();
        jTHost = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jLLocalidad4 = new javax.swing.JLabel();
        jLLocalidad5 = new javax.swing.JLabel();
        jTCarpeta1 = new javax.swing.JTextField();
        jLLocalidad6 = new javax.swing.JLabel();
        jComboUnidad = new javax.swing.JComboBox();
        jTHost1 = new javax.swing.JTextField();
        jRRemoto = new javax.swing.JRadioButton();
        jRLocal = new javax.swing.JRadioButton();
        jLabel1 = new javax.swing.JLabel();
        jBSalir = new javax.swing.JButton();
        jBGuardar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Configuraciones");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Configuraciones de Red"));

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Servidor Remoto"));

        jLLocalidad2.setBackground(new java.awt.Color(255, 255, 204));
        jLLocalidad2.setText("Host");
        jLLocalidad2.setOpaque(true);
        jLLocalidad2.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jLLocalidad2KeyPressed(evt);
            }
        });

        jLLocalidad3.setBackground(new java.awt.Color(255, 255, 204));
        jLLocalidad3.setText("Carpeta");
        jLLocalidad3.setOpaque(true);
        jLLocalidad3.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jLLocalidad3KeyPressed(evt);
            }
        });

        jTCarpeta.setToolTipText("ingrese letras para realizar un filtrado del listado.");
        jTCarpeta.setDisabledTextColor(new java.awt.Color(0, 0, 0));
        jTCarpeta.setEnabled(false);
        jTCarpeta.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTCarpetaKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTCarpetaKeyReleased(evt);
            }
        });

        jTHost.setToolTipText("ingrese letras para realizar un filtrado del listado.");
        jTHost.setDisabledTextColor(new java.awt.Color(0, 0, 0));
        jTHost.setEnabled(false);
        jTHost.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTHostKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTHostKeyReleased(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jLLocalidad2, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTHost, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(64, 64, 64)
                .addComponent(jLLocalidad3, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTCarpeta, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(40, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jLLocalidad2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLLocalidad3, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
                            .addComponent(jTCarpeta, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jTHost, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Servidor Local"));

        jLLocalidad4.setBackground(new java.awt.Color(255, 255, 204));
        jLLocalidad4.setText("Host");
        jLLocalidad4.setOpaque(true);
        jLLocalidad4.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jLLocalidad4KeyPressed(evt);
            }
        });

        jLLocalidad5.setBackground(new java.awt.Color(255, 255, 204));
        jLLocalidad5.setText("Unidad");
        jLLocalidad5.setOpaque(true);
        jLLocalidad5.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jLLocalidad5KeyPressed(evt);
            }
        });

        jTCarpeta1.setText("temp");
        jTCarpeta1.setToolTipText("ingrese letras para realizar un filtrado del listado.");
        jTCarpeta1.setDisabledTextColor(new java.awt.Color(0, 0, 0));
        jTCarpeta1.setEnabled(false);
        jTCarpeta1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTCarpeta1KeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTCarpeta1KeyReleased(evt);
            }
        });

        jLLocalidad6.setBackground(new java.awt.Color(255, 255, 204));
        jLLocalidad6.setText("Carpeta");
        jLLocalidad6.setOpaque(true);
        jLLocalidad6.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jLLocalidad6KeyPressed(evt);
            }
        });

        jComboUnidad.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "C:", "D:", "E:", "F:", "G:", "H:", "I:", "J:", "K:" }));
        jComboUnidad.setEnabled(false);

        jTHost1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jTHost1.setText("127.0.0.1");
        jTHost1.setToolTipText("ingrese letras para realizar un filtrado del listado.");
        jTHost1.setDisabledTextColor(new java.awt.Color(0, 0, 0));
        jTHost1.setEnabled(false);
        jTHost1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTHost1KeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTHost1KeyReleased(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jLLocalidad4, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTHost1, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(28, 28, 28)
                .addComponent(jLLocalidad5, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jComboUnidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(27, 27, 27)
                .addComponent(jLLocalidad6, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTCarpeta1, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(20, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLLocalidad4, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
                    .addComponent(jLLocalidad5, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
                    .addComponent(jComboUnidad, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
                    .addComponent(jTCarpeta1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLLocalidad6, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
                    .addComponent(jTHost1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        buttonGroup1.add(jRRemoto);
        jRRemoto.setText("Remoto");
        jRRemoto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRRemotoActionPerformed(evt);
            }
        });

        buttonGroup1.add(jRLocal);
        jRLocal.setText("Local");
        jRLocal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRLocalActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12));
        jLabel1.setForeground(new java.awt.Color(255, 0, 0));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Se recomienda que la carpeta a compartir se encuentre ubicada en la raiz de la particion");
        jLabel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jRRemoto))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jRLocal))
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jRRemoto)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jRLocal)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addContainerGap())
        );

        jBSalir.setText("Salir");
        jBSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBSalirActionPerformed(evt);
            }
        });

        jBGuardar.setText("Guardar");
        jBGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBGuardarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(131, 131, 131)
                .addComponent(jBGuardar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 79, Short.MAX_VALUE)
                .addComponent(jBSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(178, 178, 178))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBGuardar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jRLocalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRLocalActionPerformed
        // TODO add your handling code here:
        if(this.jRLocal.isSelected())
         {
            this.jTHost.setEnabled(false);
            this.jTCarpeta.setEnabled(false);
            this.jTCarpeta1.setEnabled(true);
            this.jComboUnidad.setEnabled(true);
            this.jComboUnidad.requestFocus();
        }
        else
        {
            this.jTHost.setEnabled(true);
            this.jTCarpeta.setEnabled(true);
            this.jTCarpeta1.setEnabled(false);
            this.jComboUnidad.setEnabled(false);
        }
    }//GEN-LAST:event_jRLocalActionPerformed

    private void jLLocalidad2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jLLocalidad2KeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jLLocalidad2KeyPressed

    private void jLLocalidad3KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jLLocalidad3KeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jLLocalidad3KeyPressed

    private void jTCarpetaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTCarpetaKeyPressed
        // TODO add your handling code here:
}//GEN-LAST:event_jTCarpetaKeyPressed

    private void jTCarpetaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTCarpetaKeyReleased
        // TODO add your handling code here:
}//GEN-LAST:event_jTCarpetaKeyReleased

    private void jRRemotoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRRemotoActionPerformed
        // TODO add your handling code here:
        if(this.jRRemoto.isSelected())
        {
            this.jTHost.setEnabled(true);
            this.jTCarpeta.setEnabled(true);
            this.jTCarpeta1.setEnabled(false);
            this.jComboUnidad.setEnabled(false);
            this.jTHost.requestFocus();
        }
        else
        {
            this.jTHost.setEnabled(false);
            this.jTCarpeta.setEnabled(false);
            this.jTCarpeta1.setEnabled(true);
            this.jComboUnidad.setEnabled(true);
        }
            
    }//GEN-LAST:event_jRRemotoActionPerformed

    private void jLLocalidad4KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jLLocalidad4KeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jLLocalidad4KeyPressed

    private void jLLocalidad5KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jLLocalidad5KeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jLLocalidad5KeyPressed

    private void jTCarpeta1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTCarpeta1KeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTCarpeta1KeyPressed

    private void jTCarpeta1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTCarpeta1KeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_jTCarpeta1KeyReleased

    private void jLLocalidad6KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jLLocalidad6KeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jLLocalidad6KeyPressed

    private void jBGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBGuardarActionPerformed
        // TODO add your handling code here:
        if(this.control())
            this.guardar();
        else
            JOptionPane.showMessageDialog(null, "Tiene que cargar todos los campos solicitados", "Faltan Datos", JOptionPane.ERROR_MESSAGE);
    }//GEN-LAST:event_jBGuardarActionPerformed

    private void jBSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBSalirActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_jBSalirActionPerformed

    private void jTHostKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTHostKeyPressed
        // TODO add your handling code here:
}//GEN-LAST:event_jTHostKeyPressed

    private void jTHostKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTHostKeyReleased
        // TODO add your handling code here:
}//GEN-LAST:event_jTHostKeyReleased

    private void jTHost1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTHost1KeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTHost1KeyPressed

    private void jTHost1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTHost1KeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_jTHost1KeyReleased
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new UIConfiguraciones().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton jBGuardar;
    private javax.swing.JButton jBSalir;
    private javax.swing.JComboBox jComboUnidad;
    private javax.swing.JLabel jLLocalidad2;
    private javax.swing.JLabel jLLocalidad3;
    private javax.swing.JLabel jLLocalidad4;
    private javax.swing.JLabel jLLocalidad5;
    private javax.swing.JLabel jLLocalidad6;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JRadioButton jRLocal;
    private javax.swing.JRadioButton jRRemoto;
    private javax.swing.JTextField jTCarpeta;
    private javax.swing.JTextField jTCarpeta1;
    private javax.swing.JTextField jTHost;
    private javax.swing.JTextField jTHost1;
    // End of variables declaration//GEN-END:variables
    
    private void inicio()
    {
        CListar listar = new CListar();
        
        configuracion = listar.hacerListado(configuracion);
        this.jTHost.setText(configuracion.getHost().trim());
        this.jTCarpeta.setText(configuracion.getDirectorioTemp().trim());
        this.jTCarpeta1.setText(configuracion.getDirectorioTemp().trim());
    }
    
    private boolean control()
    {
        boolean bandera = true;
        // controlo la configuracion de red
        if(this.jRRemoto.isSelected())
        {
            if(this.jTHost.getText().trim().length() == 0)
                bandera = false;
            if(this.jTCarpeta.getText().trim().length() == 0)
                bandera = false;
        }
        else
            if(this.jTCarpeta1.getText().trim().length() == 0)
                bandera = false;
        return bandera;
    }
    
    private void guardar()
    {
        Configuracion conf = new Configuracion();
        conf.setCodigoMaximoCP(this.configuracion.getCodigoMaximoCP());
        conf.setCodigoMaximoCT(this.configuracion.getCodigoMaximoCT());
        
        if(this.jRRemoto.isSelected())
        {
            conf.setDirectorioTemp(this.jTCarpeta.getText().trim().toLowerCase());
            conf.setHost(this.jTHost.getText().trim().toLowerCase());
        }
        else
        {
            conf.setDirectorioTemp(String.valueOf(this.jComboUnidad.getSelectedItem()).trim() + this.jTCarpeta1.getText().trim().toLowerCase());
            conf.setHost(this.jTHost1.getText().trim().toLowerCase());
        }
        conf.setIdproducto(this.configuracion.getIdproducto());
        CAlta alta = new CAlta();
        if(alta.hacerAlta(conf) == 0)
        {
            JOptionPane.showMessageDialog(null, "Las configuraciones se guardaron con exito", "Actualizacion completa", JOptionPane.INFORMATION_MESSAGE);
            this.dispose();
        }
            
        else
            JOptionPane.showMessageDialog(null, "No se puede actualizar la configuracion, inetnte mas tarde", "Error de actualizacion", JOptionPane.ERROR_MESSAGE);
    }
    
}
